home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
051-075
/
disk_069
/
spool
/
dates.c
next >
Wrap
Text File
|
1992-05-06
|
714b
|
26 lines
/* juldate.c - convert dates */
Julian_to_Gregorian(inday, year, month, day) /* julian day to month and day */
register short int inday;
int *year, *month, *day;
{
register short int leap_year, m;
static short month_days[] = { /* in leap year */
0, 31, 60, 91, 121, 152,
182, 213, 244, 274, 305, 335, 366};
#define APRIL 92
#define JUNE 183
#define SEPTEMBER 275
leap_year = ((*year % 4) == 0); /* approximately */
if (!leap_year && (inday > 59)) inday++;
if (inday < JUNE)
m = (inday < APRIL) ? 0 : 3;
else
m = (inday < SEPTEMBER) ? 6 : 9;
for ( ; inday > month_days[m]; m++); /* find month */
*day = inday - month_days[m-1] + 1;
*month = m;
}